# 第一阶段：构建
FROM node:18-alpine AS builder
WORKDIR /app
# 复制整个项目
COPY . .
# 安装依赖并构建
RUN npm ci && npm run build

# 第二阶段：运行
FROM nginx:alpine
# 仅复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80